package ncs.common.util;

import java.sql.Connection;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class ConnectDB {
	public static Connection getConnection()
	{
		Connection conn=null;
		try
		{
			Context contex=new InitialContext();
			DataSource ds = (DataSource)contex.lookup("java:comp/env/jdbc/netcourse");
			conn=ds.getConnection();
		}
		catch(Exception e)
		{
			return null;
		}
		return conn;
	}
}
